package com.onelap.bls.tc2.ble;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;

public interface BleCallback {


    /**
     * 含有蓝牙权限
     *
     * @param isDoNext 是否执行下一步操作
     */
    void bleHaveBlePermission(boolean isDoNext);

    /**
     * 服务已经连接   使用BleUtil.getService()获取BleService
     *
     * @param componentName componentName
     * @param iBinder       iBinder
     */
    void bleServiceConnected(ComponentName componentName, IBinder iBinder);

    /**
     * 服务失去连接
     *
     * @param componentName componentName
     */
    void bleServiceDisConnected(ComponentName componentName);


    /**
     * 获取服务BroadcastReceiver 数据
     *
     * @param context context
     * @param intent  intent
     */
    void bleServiceOnReceive(Context context, Intent intent);


    /**
     * 蓝牙支持或打开状态
     *
     * @param isSupport 设备是否支持蓝牙
     * @param isEnable  蓝牙是否打开
     */
    void bleBluetoothEnableState(boolean isSupport, boolean isEnable);

    /**
     * 搜索蓝牙设备
     *
     * @param bluetoothDevice     蓝牙设备
     * @param rssi                接收信号强度
     * @param scanRecord          报文
     * @param scanDeviceStateCode 搜索状态  （未开始，搜索中，搜索结束）
     */
    void bleLeScanDevice(BluetoothDevice bluetoothDevice, int rssi, byte[] scanRecord, BleParams.ScanDeviceStateCode scanDeviceStateCode);


    /**
     *
     * @param gatt
     * @param status
     * @param newState
     */
    void bleOnGattCallbackConnectionStateChange(BluetoothGatt gatt, int status, int newState);

    void  bleOnGattCallbackServicesDiscovered(BluetoothGatt gatt, int status);

    /**
     *
     * @param gatt
     * @param characteristic
     */
    void bleOnGattCallbackCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic);

    /**
     *
     * @param gatt
     * @param characteristic
     * @param status
     */
    void bleOnGattCallbackCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status);

    /**
     *
     * @param gatt
     * @param characteristic
     * @param status
     */
    void bleOnGattCallbackCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status);


}
